#!/usr/bin/sh

gpu=
setting=
models_folder="../models/seg/"
train_files="/home/leo/Downloads/training_data_set/shapeNet//train_val_files.txt"
val_files="/home/leo/Downloads/training_data_set/shapeNet/test_files.txt"

usage() { echo "train/val pointcnn_seg with -g gpu_id -x setting options"; }

gpu_flag=0
setting_flag=0
while getopts g:x:h opt; do
  case $opt in
  g)
    gpu_flag=1;
    gpu=$(($OPTARG))
    ;;
  x)
    setting_flag=1;
    setting=${OPTARG}
    ;;
  h)
    usage; exit;;
  esac
done

shift $((OPTIND-1))

if [ $gpu_flag -eq 0 ]
then
  echo "-g option is not presented!"
  usage; exit;
fi

if [ $setting_flag -eq 0 ]
then
  echo "-x option is not presented!"
  usage; exit;
fi

if [ ! -d "$models_folder" ]
then
  mkdir -p "$models_folder"
fi


echo "Train/Val with setting $setting on GPU $gpu!"
CUDA_VISIBLE_DEVICES=$gpu python3 ../train_val_seg.py -t $train_files -v $val_files -s $models_folder -m pointcnn_seg -x $setting > $models_folder/pointcnn_seg_$setting.txt 2>&1 &

#python train_val_seg.py -t /home/leo/Downloads/training_data_set/shapeNet/train_files.txt -v /home/leo/Downloads/training_data_set/shapeNet/val_files.txt -s ./model -m pointcnn_seg -x shapenet_x8_2048_fps
# -t ./data_3d_pts_lit/training/ -v ./data_3d_pts_lit/testing/ -s ./model -m pointcnn_seg -x shapenet_x8_2048_fps_autodri
# -t /home/leo/Downloads/training_data_set/auto_drive/3dpoints/training -v /home/leo/Downloads/training_data_set/auto_drive/3dpoints/testing -s ./model -m pointcnn_seg -x shapenet_x8_2048_fps_autodri
# -t ./data_3d_pts_lit/training/out -v ./data_3d_pts_lit/training/out -s ./model -m pointcnn_seg -x shapenet_x8_2048_fps_autodri
# -t /home/leo/Downloads/training_data_set/autodri/training/out_0_1800 -v /home/leo/Downloads/training_data_set/autodri/training/out_1800_2000 -s ./model -m pointcnn_seg -x shapenet_x8_2048_fps_autodri
#  -t ./data_3d_pts_lit/training/out -v ./data_3d_pts_lit/training/out -s ./model -m pointcnn_seg_modiNet -x shapenet_x8_2048_fps_autodri_modiNet

# training for 50000
# -t /home/leo/Downloads/training_data_set/autodri/training/out -v /home/leo/Downloads/training_data_set/autodri/training/out_1800_2000 -s ./model -m pointcnn_seg -x shapenet_x8_2048_fps_autodri
#


